package gdkm.wsz.dao;

import gdkm.wsz.pojo.Department;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DepartmentDAO {
    @Select("select * from department where id=#{id}")
    public Department findById(Integer id);
    @Select("select * from department where name= #{name}")
    public Department findByName(String name);
    @Select("select * from department")
    public List<Department> findAll();
    @Insert("insert into department(name,description,created_time) values(#{name},#{description},#{created_time})")
    public boolean save(Department department);
    @Update("update department set name= #{name},description= #{description},created_time= #{created_time} where id= #{id}")
    public boolean update(Department department);
    @Delete("delete from department where id= #{id}")
    public boolean delete(Integer id);
}